Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use fetch() instead of adding <script> tag for better Content-Security-Policy. #309

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rgroenewoudt
Copy link

The Bing layer loads JSON from dev.virtualearth.net. This is done by adding a <script> with a JSONP url which requires the domain added to script-src in the Content Security Policy.

This PR changes it to a fetch() which loads JSON and thus only requires adding the domain to safer connect-src in the Content-Security-Policy.

@johnd0e
Copy link
Contributor

johnd0e commented Jun 15, 2023

But we should also consider compatibility: https://caniuse.com/fetch
Is it time to say goodbye to IE and old Android?

@rgroenewoudt
Copy link
Author

As this is a very simple usage of fetch(), a polyfill like https://github.com/github/fetch will work for backwards compatibility with old browsers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants